<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'tce.label', default: 'Tce')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="body">
            <div class="cabelistlateral"><img src="${resource(dir:'images',file:'seta_cabecalho_20x20.png')}" /> Criar TCE</div><br/>
            <g:form action="save" >
                <input type="hidden" name="solicitacao.id" value="${tceInstance.solicitacao}"
                <div class="dialog dadospessoais">
                    <g:if test="${flash.message}">
                        <div class="message">${flash.message}</div>
                    </g:if>
                    <g:hasErrors bean="${tceInstance}">
                        <div class="errors erro">
                            <g:renderErrors bean="${tceInstance}" as="list" />
                        </div>
                    </g:hasErrors>
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="sequencia"><g:message code="tce.sequencia.label" default="Sequência" /></label>
                                </td>
                                <td class="value ${hasErrors(bean: tceInstance, field: 'sequencia', 'errors')}">
                                  <input type="hidden" name="sequencia" value="${tceInstance?.sequencia}"/>
                                  <b>${tceInstance?.sequencia}</b>
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dtInicio"><g:message code="tce.dtInicio.label" default="Data Início" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'dtInicio', 'errors')}">
                                    <g:datePicker name="dtInicio" precision="day" value="${tceInstance?.dtInicio}"  />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="instituicaoEnsino"><g:message code="tce.instituicaoEnsino.label" default="Instituicao Ensino" /></label>
                                </td>
                                <%
                                if(instituicaoEnsino){
                                    %>
                                    <td valign="top">
                                        <select name="instituicaoEnsino.id"
                                            <option value="">Selecione</option>
                                            <%
                                            for (int i=0; i<instituicaoEnsino.size(); i++){
                                                %>
                                                <option value="${instituicaoEnsino.id[i]}">${instituicaoEnsino.nome[i]}</option>
                                                <%
                                            }
                                            %>
                                        </select>
                                    </td>
                                    <%
                                }
                                %>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="curso"><g:message code="tce.curso.label" default="Curso" /></label>
                                </td>
                                <%
                                if(cursoInstance){
                                    %>
                                    <td valign="top">
                                        <select name="curso.id"
                                            <option value="">Selecione</option>
                                            <%
                                            for (int i=0; i<cursoInstance.size(); i++){
                                                %>
                                                <option value="${cursoInstance.id[i]}">${cursoInstance.descricao[i]}</option>
                                                <%
                                            }
                                            %>
                                        </select>
                                    </td>
                                    <%
                                }else{
                                    %>
                                    <td class="message">Estagiário não possui formação.</td>
                                    <%
                                }
                                %>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="supNome"><g:message code="tce.supNome.label" default="Supervisor" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'supNome', 'errors')}">
                                    <g:textField name="supNome" value="${tceInstance?.supNome}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="supCpf"><g:message code="tce.supCpf.label" default="CPF Supervisor" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'supCpf', 'errors')}">
                                    <g:textField name="supCpf" maxlength="25" value="${tceInstance?.supCpf}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="atividades"><g:message code="tce.atividades.label" default="Atividades" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'atividades', 'errors')}">
                                    <g:textArea name="atividades" cols="40" rows="5" value="${tceInstance?.atividades}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="chSemanal"><g:message code="tce.chSemanal.label" default="Carga Horária Semanal" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'chSemanal', 'errors')}">
                                    <g:textField name="chSemanal" value="${fieldValue(bean: tceInstance, field: 'chSemanal')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="seguradora"><g:message code="tce.seguradora.label" default="Seguradora" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'seguradora', 'errors')}">
                                    <g:textField name="seguradora" maxlength="100" value="${tceInstance?.seguradora}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="nroApolice"><g:message code="tce.nroApolice.label" default="Nº Apolice" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'nroApolice', 'errors')}">
                                    <g:textField name="nroApolice" maxlength="30" value="${tceInstance?.nroApolice}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="remunera"><g:message code="tce.remunera.label" default="Remuneração" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: tceInstance, field: 'remunera', 'errors')}">
                                    <g:textField name="remunera" value="${fieldValue(bean: tceInstance, field: 'remunera')}" />
                                </td>
                            </tr>

                            <tr>
                              <td></td>
                              <td class="btsalvarcadastro">
                                  <g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" />
                              </td>
                            </tr>

                        </tbody>
                    </table>
                </div>
            </g:form>
        </div>
    </body>
</html>
